<template>
	<view class="mcontent">
		<text class="mitem"
		 :style="{'background-color':2==item.inforCode||9==item.inforCode||11==item.inforCode?'#B0D0FF':
		 3==item.inforCode||7==item.inforCode||8==item.inforCode||12==item.inforCode||16==item.inforCode||17==item.inforCode?'#E5E5E5':
		 4==item.inforCode||5==item.inforCode||13==item.inforCode||14==item.inforCode?'#FFC2C2':
		 '#FFEFBE',
		 'color':2==item.inforCode||9==item.inforCode||11==item.inforCode?'#1573FF':
		 3==item.inforCode||7==item.inforCode||8==item.inforCode||12==item.inforCode||16==item.inforCode||17==item.inforCode?'#333333':
		 4==item.inforCode||5==item.inforCode||13==item.inforCode||14==item.inforCode?'#E93131':
		 '#FFC000'}"
		 v-for="(item, index) in dataList" :key="index" @click="itemClick(item)">{{item.inforName}}</text>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderListBean: {},
				dataList: [],
				activitiEnable:{},
        returnFlag:null,
        changeFlag:null,
			}
		},
		methods: {
			itemClick(item){
				switch(item.inforCode){
					case '2'://交车信息
						uni.navigateTo({
							url:'/pagesB/moreinfo/returncarinfo?orderCarId='+this.orderListBean.orderCarId
						})
						break
					case '3'://付款计划
						uni.navigateTo({
							url:'/pagesB/moreinfo/pay-plan?orderCarCode='+this.orderListBean.orderCarCode
						})
						break
					case '4'://合同信息
						uni.navigateTo({
							url:'/pagesB/contract/contract-detail?contractId='+this.orderListBean.contractId
							+'&orderCarId='+this.orderListBean.orderCarId
							+'&orderCode='+this.orderListBean.orderCarCode
							+'&type='+this.orderListBean.rentType
						})
						break
					case '5'://退车信息
						// let flag = false;
						//
						// if(1==this.orderListBean.rentType){
						// 	//长租退车
						// 	flag = 1 == this.activitiEnable.carBackApprove;
						// }else if(2==this.orderListBean.rentType){
						// 	//租售退车
						// 	flag = 1 == this.activitiEnable.rentSaleApprove;
						// }else if(6 == this.orderListBean.rentType){
						// 	//直购退车
						// 	flag = 1 == this.activitiEnable.purchaseBackApprove;
						// }
						
						// if(flag){
						if(this.returnFlag == 1){
							uni.navigateTo({
								url:'/pagesB/refundandchange/refundchange-detail-workflow?returnCarType=2&orderCarNo='+this.orderListBean.orderCarCode
								+'&instanceId='+this.orderListBean.alterationInstanceId
								+'&orderCarId='+this.orderListBean.orderCarId
								+'&rentType='+this.orderListBean.rentType
								+'&orderCarStatusStr='+this.orderListBean.orderCarStatusStr
							})
						}else{
							//无工作流
							uni.navigateTo({
								url:'/pagesB/refundandchange/refundchange-detail?returnCarType=2&orderCarNo='
								+this.orderListBean.orderCarCode+'&orderCarId='+this.orderListBean.orderCarId
								+'&rentType='+this.orderListBean.rentType
								+'&orderCarStatusStr='+this.orderListBean.orderCarStatusStr
							})
						}
						
						
						break
					case '6'://换车信息
						// let flag2 = false;
						// if (1==this.orderListBean.rentType) {
						// 	//长租换车
						// 	flag2 = 1 == this.activitiEnable.rentTransferCar;
						// } else if (2==this.orderListBean.rentType){
						// 	//租售换车 ???
						// 	flag2 = 1 == this.activitiEnable.rentSaleTransferCar;
						// }
						//
						// if(flag2){
						if(this.changeFlag==1){
							uni.navigateTo({
								url:'/pagesB/refundandchange/refundchange-detail-workflow?returnCarType=1&orderCarNo='+this.orderListBean.orderCarCode
								+'&instanceId='+this.orderListBean.alterationInstanceId
								+'&rentType='+this.orderListBean.rentType
								+'&orderCarId='+this.orderListBean.orderCarId
								+'&orderCarStatusStr='+this.orderListBean.orderCarStatusStr
							})
						}else{
							//无工作流
							uni.navigateTo({
								url:'/pagesB/refundandchange/refundchange-detail?returnCarType=1&orderCarNo='+this.orderListBean.orderCarCode
								+'&rentType='+this.orderListBean.rentType
								+'&orderCarId='+this.orderListBean.orderCarId
								+'&orderCarStatusStr='+this.orderListBean.orderCarStatusStr
							})
						}
					
						break
					case '7'://应收账单
						//应收账单
						uni.navigateTo({
							url:'/pagesB/bill/bill-list?orderCarId='+this.orderListBean.orderCarId+'&receiveType=1&businessType=2'
						})
						
						break
					case '8'://已收账单
						uni.navigateTo({
							url:'/pagesB/bill/bill-list?orderCarId='+this.orderListBean.orderCarId+'&receiveType=2&businessType=2'
						})
						break
					case '9'://应退账单
						//应退账单
						uni.navigateTo({
							url:'/pagesB/bill/billback-list?orderCarId='+this.orderListBean.orderCarId+'&receiveType=1&businessType=2'
						})
						break
					case '10'://已退账单
						uni.navigateTo({
							url:'/pagesB/bill/billback-list?orderCarId='+this.orderListBean.orderCarId+'&receiveType=2&businessType=2'
						})
						break
					case '11'://违章信息
						uni.navigateTo({
							url:'/pages/illegal/illegal_list_member?customerId='+this.orderListBean.customerId
						})
						break
					case '12'://保险信息
						uni.navigateTo({
							url: '/pages/renewal/renewaldetail?id=' + this.orderListBean.carId
						})
						break
					case '13'://年检信息
						uni.navigateTo({
							url: '/pages/yearcheck/yearcheckdetail?carId=' + this.orderListBean.carId
						})
						break
					case '14'://保养信息
						uni.navigateTo({
							url: '/pages/maintain/maintaindetail?carId=' + this.orderListBean.carId
						})
						break
					case '15'://出险信息
						uni.navigateTo({
							url: '/pages/car/outdanger/car-outdangerDetail?carId=' + this.orderListBean.carId
						})
						break
					case '16'://维修信息
						uni.navigateTo({
							url: '/pages/car/repair/car-repairDetail?carId=' + this.orderListBean.carId
						})
						break
					case '17'://过户信息
						uni.navigateTo({
							url: '/pagesA/assign/assign-list?orderCarCode=' + this.orderListBean.orderCarCode
						})
						break
				}
			}
		},
		onLoad(op) {

      console.log('op==', op)

			this.orderListBean = getApp().globalData.orderListBean
			this.activitiEnable = this.$store.state.params.activitiEnable
			this.returnFlag = !uni.$u.test.isEmpty(op.returnFlag)?op.returnFlag:false
			this.changeFlag = !uni.$u.test.isEmpty(op.changeFlag)?op.changeFlag:false

			getApp().globalData.orderListBean=null

			this.$u.api.getOrderDetailsMoreInfor().then(res => {
				this.dataList = res
			})
		},
	}
</script>

<style lang="scss" scoped>
	.mcontent {
		display: flex;
		flex-wrap: wrap;
		margin: 20rpx 0 0 20rpx;
	}

	.mitem {
		width: 221rpx;
		height: 118rpx;
		line-height: 118rpx;
		text-align: center;
		margin: 0 20rpx 20rpx 0;
		border-radius: 8rpx;
		font-size: 28rpx;
	}
</style>
